set SLUG=installer
set API_LINK=https://api.dnai.io
curl -X POST %API_LINK%/signin -H "content-type: application/json" -d "{ \"login\": \"%DEPLOY_LOGIN%\", \"password\": \"%DEPLOY_PASSWORD%\"}" > tmpSIGNIN
set /p contents= < tmpSIGNIN
DEL tmpSIGNIN
(echo %contents% | jq-win64.exe -r ".token") > tmpTOKEN
set /p token= < tmpTOKEN
DEL tmpTOKEN
curl -X POST %API_LINK%/download/softwares/windows -H "authorization: Bearer %token%" -H "content-type: application/json"  -d "{ \"title\": \"Revision for %APPVEYOR_REPO_TAG_NAME%\", \"description\": \"Generated by appveyor.yml on Windows.\", \"currentVersion\": \"%APPVEYOR_REPO_TAG_NAME%\", \"slug\": \"%SLUG%\"}" > tmpSIGNIN
set /p contentsWindows= < tmpSIGNIN
DEL tmpSIGNIN
(echo %contentsWindows% | jq-win64.exe -r "._id") > tmpTOKEN
set /p id= < tmpTOKEN
DEL tmpTOKEN
curl -X PATCH %API_LINK%/download/softwares/windows/%SLUG% -H "authorization: Bearer %token%" -H "content-type: application/json"  -d "{\"title\": \"Revision for %APPVEYOR_REPO_TAG_NAME%\", \"description\": \"Generated by appveyor.sh on Windows.\", \"currentVersion\": \"%APPVEYOR_REPO_TAG_NAME%\",  \"slug\": \"%SLUG%\"}" > tmpSIGNIN
set /p contentsWindows= < tmpSIGNIN
DEL tmpSIGNIN
(echo %contentsWindows% | jq-win64.exe -r "._id") > tmpTOKEN
set /p id= < tmpTOKEN
DEL tmpTOKEN
curl -X PUT --upload-file %APPVEYOR_BUILD_FOLDER%\Windows_x64\%PACKAGE_NAME%.exe  %API_LINK%/download/softwares/windows/%SLUG%/%APPVEYOR_REPO_TAG_NAME% -H "authorization: Bearer %token%" -H "content-type: application/octet-stream" 